package com.baidu.mpks.permission.service;

import com.baidu.mpks.permission.domain.Permission;
import com.baidu.mpks.permission.dto.AuthInfoDto;

import java.util.*;

public interface PermissionService {

    Map<String, Object> getPermissionList(Integer pageNum, Integer pageSize);

    List<Permission> findAll(Integer pageNum, Integer pageSize);

    List<Permission> getPermissionListByType(List<Integer> typeList);

    Set<String> findPermissonCodesByUserId(String userId);

    Set<String> findPermissionCodesByRoleIds(Collection<Integer> roleIds);

    void deleteDataPermissionByDataId(AuthInfoDto authInfoDto);

    List<String> addDataPermissionByDataIdV2(AuthInfoDto authInfoDto);

    public static enum IDTYPE {
        SOURCE("source"),
        TYPE("type"),
        RECORD("record"),
        FIELD("field");

        private String name;

        private IDTYPE(String name) {
            this.name = name;
        }

        public String getName() {
            return this.name;
        }
    }

    public static enum OP {
        READ("r"),
        MANAGEREAD("mr"),
        SEARCHDOWNLOAD("sd"),
        SEARCHINFO("si"),
        SEARCHPREV("so");

        private String name;

        private OP(String name) {
            this.name = name;
        }

        public static PermissionService.OP of(String name) {
            byte var2 = -1;
            switch(name.hashCode()) {
                case 114:
                    if (name.equals("r")) {
                        var2 = 0;
                    }
                    break;
                case 3493:
                    if (name.equals("mr")) {
                        var2 = 1;
                    }
                    break;
                case 3665:
                    if (name.equals("sd")) {
                        var2 = 2;
                    }
                    break;
                case 3670:
                    if (name.equals("si")) {
                        var2 = 3;
                    }
                    break;
                case 3676:
                    if (name.equals("so")) {
                        var2 = 4;
                    }
            }

            switch(var2) {
                case 0:
                    return READ;
                case 1:
                    return MANAGEREAD;
                case 2:
                    return SEARCHDOWNLOAD;
                case 3:
                    return SEARCHINFO;
                case 4:
                    return SEARCHPREV;
                default:
                    return null;
            }
        }

        public static Set<String> getNames() {
            Set<String> nameSet = new HashSet();
            PermissionService.OP[] var1 = values();
            int var2 = var1.length;

            for(int var3 = 0; var3 < var2; ++var3) {
                PermissionService.OP p = var1[var3];
                nameSet.add(p.getName());
            }

            return nameSet;
        }

        public String getName() {
            return this.name;
        }
    }
}
